package com.controller.manage;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.po.RulePoint;
import com.service.manage.RulePointService;

@Controller
@RequestMapping("/jsp/manager")
public class RulePointController {
	@Resource(name = "rulePointServiceImp")
	private RulePointService rulePointService;
	@ResponseBody
	@RequestMapping(value = "/getRulePointList")
	public Map<String, Object> getRulePointList(RulePoint rulePoint,Integer page,Integer rows) {
		rulePoint.setPage(((page-1)*rows));
		rulePoint.setRows(rows);
		System.out.println(rulePoint.getPage()+" "+rulePoint.getRows());
		
		List<RulePoint> list=rulePointService.getRulePointList(rulePoint);
		int count = rulePointService.getRulePointCount(rulePoint);
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("rows", list);
		map.put("total", count);
		return map;
	}
	@ResponseBody
	@RequestMapping(value="/updateRulePoint")
	public int updateRulePoint(RulePoint rulePoint){	
		int result = rulePointService.updateRulePoint(rulePoint);
		return result;
	}
	@ResponseBody
	@RequestMapping(value="/getRulePointNumber")
	public int getRulePointNumber(String description){	
		int point = rulePointService.getRulePointNumber(description);
		return point;
	}
}
